#/usr/bin/bash

#熟人社会提款清算文件
scp_and_move_xlsx(){
    THIS_TIME=`date`
    echo "[$THIS_TIME] scp fc4 xlsx to remote"
    for file in `ls FC4-M* 2>/dev/null`
    do
        if test -f $file
        then
            echo "file:  $file"
            scp $file www@mall.foodtrust.cn:~/fc4/public/uploads/settle
            mv $file $1
        #elif test -d $file
        #then
        #    echo "path: $file"
        fi
    done
}

#图腾生命每日海报背景
scp_and_move_dcc(){
    THIS_TIME=`date`
    echo "[$THIS_TIME] scp totem dcc to remote"
    for file in `ls DCC-BG* 2>/dev/null`
    do
        if test -f $file
        then
            echo "file:  $file"
            scp $file www@totembio.cn:~/tutem_mall/public/uploads/dcc/$file
            mv $file $1
        #elif test -d $file
        #then
        #    echo "path: $file"
        fi
    done
}

#所有daily_buyers_info_ddddyymm.xls数据
move_dbi_xls(){
    THIS_TIME=`date`
    echo "[$THIS_TIME] move dbi excel to data"
    for file in `ls daily_buyers_info* 2>/dev/null`
    do
        if test -f $file
        then
            echo "file:  $file"
            mv $file $1
        fi
    done
}

COUNTER=0
while [ $COUNTER -lt 1 ]
do
    scp_and_move_xlsx "data" 
    move_dbi_xls "dbi"
    #scp_and_move_dcc "dcc" 
    sleep 300
done
